package vn.fpt.fsoft.cuongn.util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DatabaseManager {

	public Connection con;

	public DatabaseManager() throws ClassNotFoundException, SQLException {
		try {
			String url = "jdbc:mysql://localhost:3306/";
			String db = "jsf_learn";
			String user = "root";
			String pass = "";

			Class.forName("com.mysql.jdbc.Driver");
			con = DriverManager.getConnection(url + db, user, pass);

		} catch (ClassNotFoundException e) {
			e.printStackTrace();
			throw e;
		} catch (SQLException e) {
			e.printStackTrace();
			throw e;
		}

	}

	public void close() {
		try {
			con.close();
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}

	

}
